package com.itheima.web.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface UserMapper1 {
    //做一个登录页面:

    /**
     * 根据用户名和密码进行用户登录
     * @param userName
     * @param password
     * @return
     */
    @Select("select * from user where username=#{username} and password=#{password}")
    com.itheima.pojo.user SelectAll(@Param("username") String userName, @Param("password") String password);

    /**
     * 注册:
     * 根据用户名判断用户是否在数据库中存在
     * @param username
     * @return
     */
    @Select("select * from user where username=#{username}")
    com.itheima.pojo.user SelectUsername(@Param("username") String username);

    /**
     * 注册添加用户
     * @return
     */
    @Insert("insert into user (username, password) values (#{username}, #{password})")
    void addUser(com.itheima.pojo.user user);
}
